package com.waimai.app.qa.support;

import java.io.IOException;

/**
 * Auto operate dynatrace tool
 * 
 * @author AiHui
 * 
 */
public class DynatraceClient {
	private String dtPath;

	@SuppressWarnings("unused")
	private DynatraceClient() {
	}
	
	/**
	 * 可在Run Configuration中配置 Environment 变量，添加DT_AE_AGENTACTIVE true
	 * DT_AE_AGENTNAME Firefox
	 * 
	 * 且设置
	 * ProfilesIni profile = new ProfilesIni();
	 * FirefoxProfile ffprofile = profile.getProfile("default")
	 * 
	 * 或在代码中设置环境变量
	 * SET DT_AE_AGENTACTIVE=true
	 * SET DT_AE_AGENTNAME=Firefox
	 * 
	 * @param dynatracePath the dynatrace tool set-up full path,
	 *            e.g.
	 *            "C:\\Program Files\\dynaTrace\\dynaTrace AJAX Edition 3.1\\dtajax.exe"
	 */
	public DynatraceClient(String dynatracePath) {
		this.dtPath = dynatracePath;
	}

	/**
	 * start dynatrace
	 */
	public void start() {
		try {
			Runtime.getRuntime().exec(dtPath);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}